import * as Router from 'koa-router'
import { CityTS, CountryTS } from '../db/sequelize_ts'


const router = new Router({ prefix: '/settingUp' })
  .get('/', async ctx => {
    try {
      // await sequelize.authenticate()
      // ctx.body = await CityTS.findOne({ include: [ CountryTS ] })
      ctx.body = await CountryTS.findAndCount({ include: [ CityTS ], limit: 50 })
    } catch (e) {
      console.log(e)
      ctx.body = 'authenticate fail'
    }
  })

export const settingUp = [ router.routes(), router.allowedMethods() ]
